/*
 * Copyright (c) 2025 [ByteDance Ltd. and/or its affiliates.] and/or its affiliates
 * SPDX-License-Identifier: LGPL v2.1+
*/
//
//  FFmpegXORIOEncryptor.h
//  macos
//
//  Created by kevin.qiu on 2022/08/03.
//
#ifndef ANDROID_FFmpegXORIOEncryptor_H
#define ANDROID_FFmpegXORIOEncryptor_H

#include "FFmpegBaseXORIOCryptor.h"

class FFmpegXORIOEncryptor : public FFmpegBaseXORIOCryptor, public FFmpegIOEncryptor {
public:
    bool isEncryptor() const override { return true; }
    int writeBdveTag(bool writeParam) override;
    int writePacket(const uint8_t *buf, int bufSize) override;

private:

    void buildSrc(uint8_t src[16]);
    void encrpytParam(int64_t size, uint8_t dst[16]);

    static int getCrptTagSize(int version);
    static int getBdveTagSize(int version);

private:
    bool m_bSkipEncrypt = false;
};

#endif   // ANDROID_FFmpegXORIOEncryptor_H
